<?
$table="gallery_item";
if($_GET["do"]=="insert")
{
	$data=array(
	"parent" => $_GET["album"],
	"content" => $_GET["url"],
	"caption" =>""
	);
	if(insert($data,$table))
		echo "Thêm Ảnh thành công!";
	else
	echo "Có lỗi xảy ra!";
exit;
}
if($_GET["do"]=="reload")
{
	$q=query("select * from $table where parent=$_GET[album]");
	$msg="<ul>";
	while($r=fetch($q))
	{
		$msg.="<li><img src='$r[content]'><br><a href='javascript:del($r[id])'>Xóa Ảnh</a></li>";
	}
	$msg.="</ul>";
	echo $msg;
exit;
}
if($_GET["do"]=="delete")
{
	query("delete from $table where id=$_GET[id]");
exit;
}
?>